<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/resource/common.jsp"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
		<%--系统管理/数字字典 --%>
		<base href="<%=basePath%>" />
		<title>${title}</title>
		<script type="text/javascript" src="<c:url value='/resource/js/view/dict_list.js'/>"></script>	
		
		<script type="text/javascript">
			$(function(){
				$("#query_form").css({"width":$(window).width()});
					$.get(parent.formateUrl("dictionary/getvalue/0.json"), {}, function(data) {
						$.each(data.list, function(i, dict) {
							$("#dbId").append("<option value='" + dict.dbId + "'>" + dict.name + "</option>");
						});
						$("#dbId").val("${dict.dbId}");
					}, "json");
				
				$('#test').datagrid({
					iconCls:'icon-save',
					width:$(window).width(),
					height:$(window).height()-42,
					nowrap: true,
					striped: true,
					fitColumns:true,
					url:'<%=path%>/dictionary/value_mgr/list.json',
					idField:'dbId',
					singleSelect:true,
					onLoadSuccess:function(data){
						$(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
					},
					frozenColumns:[[
					]],
					columns:[
					  [	
					  	{field:'parentName',title:'字典项',width:100,align:'left'},
					  	{field:'name',title:'字典值',width:100,align:'left'},
				      	{field:'remark',title:'备注',width:300,align:'left'},
				      	{field:'orderNum',title:'排序序号',width:70,align:'center',fixed:true},
						{field:'opt',title:'操作',width:100,align:'center', fixed:true,
							formatter:function(value,rec){
								return "&nbsp;<a href='javascript:editDictionary("+rec.dbId+")'>修改</a>&nbsp;"+
								"&nbsp;<a href='javascript:deleteDict("+rec.dbId+")'>删除</a>&nbsp;"
								;
							}
						},
					]],
					pagination:true,
					rownumbers:true
					
				});
				var p = $('#test').datagrid('getPager');
				$(p).pagination({
					onBeforeRefresh:function(){
					}
				});				

			});
			
		</script>
</head>
<body >
	<div>
		<div>
	    	<form class="app_form_query" id="query_form" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="4" style="background:#e9f8ff; border:1px solid #cbd9e4; font-size:14px;">
	    			<tr>
	    				<td class="td_label">字典项</td>
	    				<td class="td_text">
	    					<select style="width:200px" name="dbId" id="dbId">
	    						<option value="0">请选择</option>
	    					</select>
	    				<td class="td_label">字典值</td>
	    				<td class="td_text"><input type="text" id="name" name="name" style="width:180px;" value="${dict.name}"  onblur="this.value=this.value.replace(/[^\w\b\u4e00-\u9fa5]/g,'');"/></td>
	    				<td class="td_label" style="width:300px;text-align: left">
	    					<a href="javascript:_goto(1);">查询</a>&nbsp;&nbsp;
	    					<a href="javascript:formReset()">重置</a>&nbsp;&nbsp;
	    					<a href="javascript:addDictionary();">新增</a>
	    				</td>
	    				<td>&nbsp;&nbsp;</td>
	    			</tr>
	    		</table>
	    	</form>
	   	</div>
	   	<div id="tbl_container">
	   		<table id="test" data-options="toolbar:'#tb'"></table>
	   		<%--
	   		<table id="tbl_datalist" class="tbl_datalist" cellpadding="0" cellspacing="0" >
	   			<thead>
		   			<tr>
		   				<th width="35" style="text-align: left;">序号</th>
		   				<th style="text-align: left;">字典项</th>
		   				<th style="text-align: left;">字典值</th>
		   				<th style="text-align: left;">备注</th>
		   				<th style="text-align: left;">排序序号</th>
		   				<th style="text-align: left;">操作</th>
		   			</tr>
	   			</thead>
	   			<c:forEach var="data" items="${page.list}" varStatus="vs">
	   			<tr>
	   				<td class="txt_center" width="35" style="text-align: center;">${((page.pageIndex-1)*page.pageSize)+vs.count}</td>
		   			<td>${data.parentName}</td>
		   			<td>${data.name}</td>
		   			<td class="trim_st"><p>${data.remark}</p></td>
		   			<td>${data.orderNum }</td>
		   			<td>
		   				<a href="javascript:editDictionary('${data.dbId}',${page.pageIndex})">修改</a>
		   				<a href="javascript:deleteDict('${data.dbId}',${page.pageIndex})">删除</a>
		   			</td>
	   			</tr>
	   			</c:forEach>
	   		</table>
	   		 --%>
		</div>
		
	</div>
</body>
</html>